import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export default new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: [
    {
      path: '/',
      redirect: '/login',
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('./views/login')
    },
    {
      path: '/index',
      name: 'index',
      redirect: './home',
      component: () => import('./views/index'),
      children: [
        {
          path: '/home',
          name: 'home',
          component: () => import('./views/home')
        },
        {
          path: '/my',
          name: 'My',
          component: () => import('./views/my.vue')
        },
        {
          path: '/cart',
          name: 'cart',
          component: () => import('./views/cart.vue')
        },
        {
          path: '/sort',
          name: 'sort',
          component: () => import('./views/sort.vue')
        }
      ]
    },
    {
      path: '/about',
      name: 'about',
      component: () => import('./views/About.vue')
    }
  ]
})
